package com.example.vv.model.setting;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.example.vv.R;
import com.example.vv.fragmentWork.mvp.MvpActivity;
import com.example.vv.fragmentWork.utlis.ShareUtils;
import com.example.vv.fragmentWork.view.CustomerTitleBar;
import com.example.vv.model.main.MainActivity;
import com.example.vv.model.setting.base.contract.SettingContract;
import com.example.vv.model.setting.base.presenter.SettingPresenter;

import butterknife.BindView;
import butterknife.OnClick;

public class SettingActivity extends MvpActivity<SettingContract.View, SettingPresenter> implements SettingContract.View {

    @BindView(R.id.setting_title)
    CustomerTitleBar settingTitle;
    @BindView(R.id.setting_tui)
    LinearLayout settingTui;

    @Override
    public int initLayout() {
        return R.layout.activity_setting;
    }

    @Override
    public SettingPresenter initPresenter() {
        return new SettingPresenter();
    }

    @Override
    public void initView() {
        settingTitle.getCenter_tx().setText("设置");
        settingTitle.getLeft_img().setImageResource(R.mipmap.ic_back);
        settingTitle.getLeft_img().setOnClickListener((v) -> {
            finish();
        });
    }

    @Override
    public void initData() {
    }

    @Override
    public void doBusiness() {

    }

    @Override
    public View titleView() {
        return null;
    }


    @Override
    public Context getMContext() {
        return getMContext();
    }


    @OnClick(R.id.setting_tui)
    public void onViewClicked() {
        ShareUtils.clearUserInfo(this);
        if (!ShareUtils.isLogin) {
            Intent intent = new Intent(this, MainActivity.class);
            intent.putExtra("name","");
            setResult(99,intent);
            Toast.makeText(this, "已退出", Toast.LENGTH_SHORT).show();
        }
    }
}